package ar.com.spsolutions.splibrary.book;

import org.joda.time.DateTime;

import ar.com.spsolutions.splibrary.user.User;

public class LoanBookBuilder {

	private transient LoanBook toBuild;

	public static LoanBook createInstanceForTest() {
		return new LoanBookBuilder()//
				.build();
	}

	public LoanBookBuilder() {
		this.toBuild = new LoanBook();
	}

	public LoanBookBuilder withCopy(final BookCopy value) {
		this.getToBuild().setCopy(value);
		return this;
	}

	public LoanBookBuilder withLoanDate(final DateTime value) {
		this.getToBuild().setLoanDate(value);
		return this;
	}

	public LoanBookBuilder withExpirationDate(final DateTime value) {
		this.getToBuild().setExpirationDate(value);
		return this;
	}

	public LoanBookBuilder withUser(final User value) {
		this.getToBuild().setUser(value);
		return this;
	}

	public LoanBookBuilder withRefunDate(final DateTime value) {
		this.getToBuild().setRefundDate(value);
		return this;
	}

	public LoanBook build() {
		final LoanBook temp = this.getToBuild();
		this.toBuild = new LoanBook();
		return temp;
	}

	private LoanBook getToBuild() {
		return this.toBuild;
	}
}
